<?php

/*
 * This file is part of the prestaBreadcrumb package.
 * (c) Julien Fusco <jfusco@prestaconcept.net>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * presta breadcrumb config handler
 * 
 * @author	Julien Fusco <jfusco@prestaconcept.net>
 * @version	SVN: $Id: $ 1.0 - 7 déc. 2009 - Julien Fusco <jfusco@prestaconcept.net>
 * @since	7 déc. 2009 - Julien Fusco <jfusco@prestaconcept.net>
 */
class prestaBreadcrumbConfigHandler extends sfYamlConfigHandler
{
	public function execute($configFiles)
	{
		$config = $this->parseYamls($configFiles);

		// We will parse the yaml to build the breadcrumb,
		// each row of the array returned is an item which
		// we will add to the breadcrumb.
		
		$data  = "<?php \n";

		// Build the breadcrumb
		foreach($config as $item => $detail)
		{
			// Add item
			$data .= "prestaBreadcrumb::getInstance()->addItem('" . addcslashes($detail['text'], "'") . "', '" . addcslashes($detail['uri'], "'") . "');\n";
		}

		return $data;
	}
}
